<template>
  <el-container>
    <el-header style="padding:0px">
      <el-row :gutter="20" class="header-banner">
        <el-col :span="4"><div class="grid-content"></div></el-col>
        <el-col :span="20"><div class="grid-content" style="color: #818C9E">从这里开始.</div></el-col>
        <el-col :span="4"><div class="grid-content"></div></el-col>
        <el-col :span="20"><div class="grid-content" style="color: #4A90E2">扩展你的人脉圈.</div></el-col>
      </el-row>
    </el-header>
    <img class="line-image" src="../assets/fill.png"/>
    <div class="main-background">
      
      <div class="bottom" v-if="join">

        <div class="bot-title">
            <div></div>
            <h2>倒计时</h2>
        </div>
        <div class="bot-info">
            你已成功报名本场活动，距离分组结果公布还有：<br/>
        </div>

        <div class="bot-time">
            <span class="time">{{day}}</span>
            天
            <span class="time">{{hour}}</span>
            时
            <span class="time">{{minute}}</span>
            分
            <span class="time">{{second}}</span>
            秒
        </div>

      </div>


    </div>

  </el-container>
</template>

<script>
    export default {
      name: "JoinCount",
      data() {
        return {

          join:false,
          day:0,
          minute:0,
          hour:0,
          second:0,
          next:new Date(),
          id:0

        };
      },
      created:function(){

        this.$axios.get('/manghe/api/party_next').then(res =>{

            console.log(res)
            this.next = new Date(res.result.open_time)
            this.id = res.result.id
            if(res.result.join_time){

              this.join = true

              setInterval(()=>{
                var s = parseInt((this.next.getTime() - (new Date()).getTime())/1000)

                this.day = parseInt(s/3600/24)
                this.hour = parseInt(s/3600 % 24)
                this.minute = parseInt(s/60 % 60)
                this.second = s % 60

            },500);
            
            }else{
              this.$router.push('/joinmatch')

            }
      

        });

        
      },
      methods: {
        handleSelect(key, keyPath) {
          console.log(key, keyPath);
        }
      }
    }
</script>

<style scoped>
  .line-image {
    width: auto;
    margin-left: -8px;
    margin-right: -8px;
    height: 30px;
    margin-top: 80px;
  }
  .main-background {
    width: auto;
    margin-top: -2px;
    margin-left: -8px;
    margin-right: -8px;
    background-color: #4A90E2;
    min-height: 450px;
  }
  .main-background :after{
    height: auto;
  }
  .grid-content {
    min-height: 36px;
  }
  
  .header-banner {
    font-size: 29px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    line-height: 41px;
    text-align: left;
    padding:30px 0px;
    background-color:#FFF;
  }
  .main-title {
    text-align: left;
    height: 29px;
    font-size: 21px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 29px;
    border-left: #FFFFFF solid 6px;
  }
  .main-row {
    text-align: left;
    font-size: 18px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 25px;
  }
  .one-button {
    margin-top: 60px;
    width: 171px;
    height: 57px;
    background: #FFFFFF;
    border-radius: 645px;
    font-size: 21px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    color: #4A90E2;
  }

.bot-btn{
  margin:15px;
}

.bot-time{
    font-size:21px;
    color:#FFF;
    font-weight:200;
}
.bot-time .time{
    font-size:32px;
    font-weight: 500;
}

.bot-title>div{
    width:6px;
    height:17px;
    display:inline-block;
    border-radius:4px;
    background-color:#FFF;
    margin-bottom:-3px;
}
div.bot-title h2{
    color:#FFF;
    font-size:21px;
    display: inline-block;
    margin-left:10px;
}
div.bot-title {
    text-align: left;
    padding:0px 30px;
}
div.bot-info{
    color:#FFF;
    font-size:18px;
    font-weight: bold;
    text-align: left;
    padding:20px 25px;
}

.bottom{
    background-color:#4A90E2;

}
</style>